package MyOop03;

import java.util.Arrays;

public class GoodsTest {
    public static void main(String[] args) {
        //创建对象数组
        Goods[] arr = new Goods[3];

        //创建三个商品对象
        Goods a1 = new Goods("001","小米手机",1999,100);
        Goods a2 = new Goods("002","保温杯",20.0,20);
        Goods a3 = new Goods("003","枸杞",13.7,70);
        //商品添加到数组中
        arr[0] = a1;
        arr[1] = a2;
        arr[2] = a3;
        //遍历数组
        for (int i = 0; i < 3; i++) {
             Goods goods = arr[i];
            System.out.println(goods.getId()+","+goods.getName()+","+goods.getPrice()+","+goods.getCount());
        }
    }
}
